package com.woniuxy.book.util;



public class RedisKeyUtil {
    /*
    * 注册短信验证码KEY
    * */
    public static String registerCodeKey(String userPhone){
        return "register:code:phone:"+userPhone;
    }

    /*
    * 一分钟内是否发送过注册短信key
    * */
    public static String registerCodeMinute(String userPhone){
        return "register:code:minute:phone:"+userPhone;
    }

    /*
    * 一小时内发送短信的总次数
    * */
    public static String sendNumbers(String userPhone){
        return "register:numbers:phone:"+userPhone;
    }

    /*
     * 登录短信验证码KEY
     * */
    public static String loginCodeKey(String userPhone){
        return "login:code:phone:"+userPhone;
    }

    /*
     * 一分钟内是否发送过登录短信key
     * */
    public static String loginCodeMinute(String userPhone){
        return "login:code:minute:phone:"+userPhone;
    }

    /*
     * 一小时内发送登录短信的总次数
     * */
    public static String loginSendNumbers(String userPhone){
        return "login:numbers:phone:"+userPhone;
    }

    /*
    * 某个用户的书籍收藏列表KEY
    * */
    public static String collectBook(Integer userId){
        return "collect:book:userId:"+userId;
    }

    /*
    * 书籍收藏排行榜KEY
    * */
    public static String collectBookRank(){
        return "collect:book:rank";
    }

    /*
    * 图书类别树形数据缓存KEY
    * */
    public static String cacheBookTypeTree(){
        return "cache:booktype:tree";
    }


    /*
    * 保存某用户在平台中的购物车中的商品ID集合KEY
    * */
    public static String userShoppingCar(Integer userId){
        return "shopping:car:userid:"+userId;
    }

    /*
    * 保存用户购物车某一条记录的详细信息KEY
    * */
    public static String shoppingCarInfo(Integer userId,Integer bookId){
        return "shopping:car:userid"+userId+":bookid:"+bookId;
    }

    /*
    * 注册用户名锁
    * */
    public static String lockRegisterByUsername(String userName){
        return "lock:register:username:"+userName;
    }

    /*
    * 注册用户电话锁
    * */
    public static String lockRegisterByUserPhone(String userPhone){
        return "lock:register:userphone:"+userPhone;
    }

    /*
    * 书id锁
    * */
    public static String lockBookId(Integer bookId){
        return "lock:bookid:"+bookId;
    }
}
